﻿Public Class MainService
    Dim DAService As New DSReservationTableAdapters.V_OTHER_SERVICETableAdapter
    Private Sub BtnNewSevice_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnNewSevice.Click
        Dim NewService As New FormNewService
        If NewService.ShowDialog = DialogResult.OK Then
            RefreshService()
        End If
    End Sub
    Private Sub RefreshService()
        GridService.DataSource = DAService.GetData
    End Sub

    Private Sub BtnServiceCategory_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnServiceCategory.Click
        Dim FCatService As New FormServiceCategory
        FCatService.ShowDialog()
    End Sub

    Private Sub BtnDeletService_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnDeletService.Click
        RefreshService()
    End Sub

    Private Sub btnUpdateService_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdateService.Click
        If GridService.SelectedItems.Count = 0 Then Exit Sub
        Dim NewService As New FormNewService
        NewService.lblSaveOption.Text = GridService.GetRow.Cells("SERVICE_ID").Value
        NewService.TxtSeviceName.Text = GridService.GetRow.Cells("SERVICE_NAME").Value
        NewService.CboCategoryName.SelectedValue = GridService.GetRow.Cells("SERVICE_CATEGORY").Value
        NewService.TxtPrice.Text = GridService.GetRow.Cells("SERVICE_PRICE").Value
        If NewService.ShowDialog = DialogResult.OK Then
            RefreshService()
        End If
    End Sub

    Private Sub MainService_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        RefreshService()
    End Sub

    Private Sub BtnTimeSetting_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnTimeSetting.Click
        Dim FSetting As New FormSetting
        FSetting.ShowDialog()
    End Sub
End Class
